class Node():
    def __init__(self, item) -> None:
        self.item = item
        self.next = None

# 头插法
def creat_linklist_head(lyst):
    head = Node(lyst[0])
    for element in lyst[1:]:
        node = Node(element)
        node.next = head
        head = node
    return head

# 尾插法
def creat_linklist_tail(lyst):
    head = Node(lyst[0])
    tail = head
    for element in lyst[1:]:
        node = Node(element)
        tail.next = node
        tail = node

def print_linklist(lk):
    while lk:
        print(lk.item, end=',')
        lk = lk.next
    print("\n", end='')
